﻿using System.Configuration;
using ZilLion.Core.Unities.UnitiesMethods;
using ZilLion.Core.Unities.UnitiesMethods.WebApi.Http;
using ZilLion.Task.Domain.Taskmanager.Entity;
using ZilLion.Task.Domain.WebEntity;

namespace ZilLion.Task.Domain.Taskmanager.Repository
{
    public class TaskNodeInfoRespository : WebApiRepositoryBase<HttpNoCompressionClient>
    {
        public bool NodeHeartbeat(string nodeid)
        {
            var nodeInfoEntity = new NodeInfoEntity
            {
                Nodeid = nodeid,
                Nodename = string.Empty,
                Nodepcname = SysHelper.ComputerName,
                Nodeip = Computer.IpAddress,
                Nodemac = Computer.MacAddress,
                Noderemark = string.Empty
            };
            var url =
                @"Api/Node/NodeHeartbeat";


            var response = HttpPost<NodeInfoEntity, ResponseResultInfo>(nodeInfoEntity, url);
            return (response != null) && response.IsSuccess;
        }
    }
}